#pragma once
#include <zCoreConfig.hpp>
#include "../common.hpp"
#include "Log.hpp"

//%b = progress bar
//%s = spin
//%p = percentage
//%n = number

namespace zzz {
class ZCORE_CLASS TextProgress
{
public:
  TextProgress(const string &_content="%s", int endvalue=0, int startvalue=0);
  void SetValue(int _endvalue, int _startvalue=0);
  void SetAppearance(char _beginchar='[', char _endchar=']', char _blankchar='-', char _fillchar='+', int _length=10);
  void SetContent(const string &_content="%s");
  void ShowProgressBegin();
  void ShowProgress(int _value);
  void ShowProgressAutoIncrease();
  void ShowProgressEnd(bool clear=false);
private:
  void clearLastMsg();
  void showBar();
  void showSpin();
  void showPercentage();
  void showNumber();
  void showContent();
private:
  int startvalue;
  int endvalue;
  int value;
  char beginchar, endchar, blankchar, fillchar;
  int length;
  string content;

  int lastlength;
};
}